package controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;


@Controller
@RequestMapping("/student")
public class StudentController {
    @RequestMapping("/login")
    public String login(HttpServletRequest request, Model model){
        String stuId = request.getParameter("stuId");
        String pwd = request.getParameter("pwd");
        if(stuId.equals("123456") && pwd.equals("123456")) {
            System.out.println("登录成功:"+stuId);
            model.addAttribute("stuId",stuId);
            return "welcome";
        }
        else{
            System.out.println("登录失败");
            model.addAttribute("err","用户名或密码错误");
            return "index";
        }
    }
}
